]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
IMStatusChooserItem: clean up signal handlers on destroy()
authorGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 17 Oct 2011 13:18:25 +0000 (15:18 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 20 Oct 2011 13:06:52 +0000 (15:06 +0200)
Extensions (like alternative-status-menu) expect that calling
destroy() on a menu item will not leave signal handlers around.

https://bugzilla.gnome.org/show_bug.cgi?id=660520

js/ui/userMenu.js

index 311ba73e69b86c63ce2308dbd606393e6cfdf781..d2b0ea37e398cc14ddd44c05102cc5fdad01d8c0 100644 (file)
@@ -199,6 +199,21 @@ IMStatusChooserItem.prototype = {
         }));
     },
 
+    destroy: function() {
+        // clean up signal handlers
+        if (this._userLoadedId != 0) {
+            this._user.disconnect(this._userLoadedId);
+            this._userLoadedId = 0;
+        }
+
+        if (this._userChangedId != 0) {
+            this._user.disconnect(this._userChangedId);
+            this._userChangedId = 0;
+        }
+
+        PopupMenu.PopupBaseMenuItem.prototype.destroy.call(this);
+    },
+
     // Override getColumnWidths()/setColumnWidths() to make the item
     // independent from the overall column layout of the menu
     getColumnWidths: function() {